<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增回收垃圾设置奖励')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-trashSetting-add">
			<div class="form-group">
				<label class="col-sm-3 control-label">回收垃圾名称：</label>
				<div class="col-sm-8">
					<div class="input-group" style="width: 100%">
						<select name="trashId" class="form-control m-b" th:with="trashs=${@trashService.selectTrashList(null)}">
							<option th:each="trash : ${trashs}" th:text="${trash.name}" th:value="${trash.id}"></option>
						</select>
					</div>
				</div>

			</div>

			<div class="form-group">	
				<label class="col-sm-3 control-label">实际垃圾名称：</label>
				<div class="col-sm-8">
					<input id="actualName" name="actualName" class="form-control" type="text">
				</div>
			</div>

			<div class="form-group">	
				<label class="col-sm-3 control-label">单位数量：</label>
				<div class="col-sm-8">
					<input id="unitNum" name="unitNum" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">奖励金额：</label>
				<div class="col-sm-8">
					<input id="rewardMoney" name="rewardMoney" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">奖励积分：</label>
				<div class="col-sm-8">
					<input id="integral" name="integral" class="form-control" type="text">
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "system/trashSetting"
		$("#form-trashSetting-add").validate({
			rules:{
				trashId:{
					required:true,
				},actualName:{
					required:true,
				},unitNum:{
					required:true,
					digits:true
				},rewardMoney:{
					required:true,
					number:true
				},integral:{
						required:true,
						digits:true
					}
			}, messages: {
				unitNum: {
					digits:"请输入整数"
				},integral: {
					digits:"请输入整数"
				}
			},
			focusCleanup: true
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/add", $('#form-trashSetting-add').serialize());
	        }
	    }
	</script>
</body>
</html>
